// 封装轮播图相关的业务代码
import { onMounted, ref } from 'vue';
import { getBannerAPI } from '@/apis/home';

export const useBanner = () => {
  const bannerList = ref([]);
  const getBanner = async () => {
    await getBannerAPI({ distributionSite: 2 }).then((response) => {
      let { code, result } = response;
      if (code === '1') {
        bannerList.value = result;
      }
    });
  };
  onMounted(() => getBanner());

  return {
    bannerList,
  };
};
